class AsinInfo < ActiveRecord::Base

  def self.include_by_title_and_id?(q,id)
    search_result_by_title = AsinInfo.find(:first,
      :conditions => ["id = ? and contents_type = 0 and sales_rank != 0 and match(title) against('#{q}')",id],
      :limit => 1
    )
    if search_result_by_title
      return search_result_by_title
    end
    #nilならこっち
    return false
  else
  end

  def self.search_by_title(q)
    return AsinInfo.find(:first,
      :conditions => ["contents_type = 0 and sales_rank != 0 and match(title) against('#{q}')"],
      :limit => 1
    )
  else
  end

end
